<template>
	<Echart :options="options" />
</template>

<script>
import Echart from '../../components/echart';

export default {
    components: {
        Echart,
    },
    props: {
        cdata: { type: Array, default: () => [] },
    },
    data() {
        return {
            options: {
                legend: {
                    orient: "horizontal",
                    icon: "circle",
                    bottom: 0,
                },
                series: [
                    {
                        type: 'pie',
                        radius: [20, 60],
                        roseType: "area",
                        center: ["50%", "42%"],
                        itemStyle: {
                            borderRadius: 5
                        },
                        label: {
                            show: true,
                            formatter: '{b} ({d}%)'
                        },
                        data: [],
                    },
                ]
            },
        };
    },
    watch: {
        cdata: {
            handler(newData) {
                this.options.series[0].data = newData;
            }
        }
    },
}
</script>
